Question: A function $f$ has the property that $f(3x-1)=x^2+x+1$ for all real numbers $x$.  What is $f(5)$?
Explanation: Let $u=3x-1$.  Then $x=(u+1)/3$, and \begin{align*}
f(u)&=\displaystyle\left(\frac{u+1}{3}\displaystyle\right)^2+\frac{u+1}{3}+1\\
&=\frac{u^2+2u+1}{9}+\frac{u+1}{3}+1\\
&=\frac{u^2+5u+13}{9}.
\end{align*}In particular, \[
f(5)=\frac{5^2+5\cdot5+13}{9} =\frac{63}{9}=\boxed{7}.
\]